package com.lvyou.config;

import com.lvyou.filter.AdminAuthFilter;
import com.lvyou.filter.UserAuthFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class FilterConfig {
    @Bean
    public FilterRegistrationBean reqResFilter1() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();

        UserAuthFilter filter = new UserAuthFilter();

        filterRegistrationBean.setFilter(filter);
        filterRegistrationBean.addUrlPatterns("/order/*");//配置过滤规则

        return filterRegistrationBean;
    }

    @Bean
    public FilterRegistrationBean reqResFilter() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();

        AdminAuthFilter reqResFilter = new AdminAuthFilter();

        filterRegistrationBean.setFilter(reqResFilter);
        filterRegistrationBean.addUrlPatterns("/mgr/*");//配置过滤规则

        return filterRegistrationBean;
    }
}
